package com.gitee.srurl.snow.backwards;

import com.gitee.srurl.snow.domain.SnowflakeData;

/**
 * 时间回拨处理
 *
 * @author zxw
 * @date 2023/4/22 10:39
 */
public abstract class AbstractBackwards {

    /**
     * 最新数据的时间戳
     */
    private long lastTimestamp;

    /**
     * 初始化雪花算法相关参数
     */
    private SnowflakeData snowflakeData;

    public AbstractBackwards(long lastTimestamp, SnowflakeData snowflakeData) {
        this.lastTimestamp = lastTimestamp;
        this.snowflakeData = snowflakeData;
    }

    public abstract long nextId();

    public abstract long getLastTimestamp();

    /**
     * 做一些清理操作
     */
    public void doClean() {
    }

    ;
}
